/**
 * @file gametester.h
 * @brief Game automated tests class definition
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 3 of the License.
 *
 * @author VestniK (Sergey N.Vidyuk) sir.vestnik@gmail.com
 * @date 17 Oct 2008
 */
#ifndef _GameTester_H_
#define _GameTester_H_

#include <QtCore/QObject>
#include <QtCore/QList>

#include "mjntypes.h"

using namespace mjn;

class GameTester: public QObject {
   Q_OBJECT;
   public slots:
      /**
       * @todo Fix me! Hack here! It looks like QSignalSpy can't work with
       * typedef. This slot created to catch argument of the
       * mjn::ServerPlayer::tileTaken signal.
       */
      void catchTile(mjn::TileID tile) {mCatchedTiles.append(tile);}
      /**
       * @todo Fix me! Hack here! This slot catches mjn::Game::newPlayer signal
       * since I cant obtain it parameter using QSignalSpy
       */
      void catchPlayersNames(const QList<QString> &names) {mCatchedNames.append(names);}
   private:
      QList<TileID> mCatchedTiles;
      QList< QList<QString> > mCatchedNames;
   private slots:
      void initTestCase();
      // Game tests
      void testNewPlayerCreation();
      void testStartGame();
      void testPlayerWindRandomization();
      void testBeginRound();
      void testSetPlayerName();
      void testStartTurn();
      void testEndTurn();
      void testSwitchTurn();
      void testTakeTile();
      void testRoundFailed();
      void testStartOfRound();
      void testTileDiscardedSignal();
      void testRoundFailedSignal();
};

#endif
